<!-- <% if user_masquerade? %>
  <div class="alert alert-warning text-center">
    You're logged in as <b><%= current_user.name %> (<%= current_user.email %>)</b>
    <%= link_to back_masquerade_path(current_user) do %><%= icon("fas", "times") %> Logout <% end %>
  </div>
<% end %> -->

<nav class="navbar navbar-expand-md navbar-light bg-light">
  <div class="container">
    <!-- <%= link_to Rails.configuration.application_name, root_path, class: "navbar-brand" %> -->
    <%= link_to t(:title), root_path, class: "navbar-brand" %>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarMain" aria-controls="navbarsExample04" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarMain">
      <ul class="navbar-nav mr-auto mt-2 mt-md-0">
      </ul>

      <ul class="navbar-nav">
        <li class="nav-item"><%= link_to t("nav-home"), root_path(locale: params[:locale]), class: "nav-link"%></li>
        <li class="nav-item"><%= link_to t("nav-introduce"), profile_path(locale: params[:locale]), class: "nav-link"%></li>
        <li class="nav-item dropdown">
          <%= link_to t("nav-products"), products_path(locale: params[:locale]), id: "navbar-dropdown", class: "nav-link dropdown-toggle", data: {toggle: "dropdown"}%>
          <div class="dropdown-menu">
            <%= link_to t("label"), label_products_path(locale: params[:locale]), class: "dropdown-item"%>
            <%= link_to t("capacitor"), capacitor_products_path(locale: params[:locale]), class: "dropdown-item" %>
            <%= link_to t("eddy"), eddy_products_path(locale: params[:locale]), class: "dropdown-item"%>
            <%= link_to t("spindle"), spindle_products_path(locale: params[:locale]), class: "dropdown-item"%>
          </div>
        </li>
        <% if params[:locale] == "chinese" %>
          <li class="nav-item"><%= link_to "English", request.original_url.gsub(/=chinese/, '=en'), class: "nav-link"%></li>
        <% elsif params[:locale] == "en" %>
          <li class="nav-item"><%= link_to "中文版", request.original_url.gsub(/=en/, '=chinese'), class: "nav-link"%></li>
        <% else %>
          <li class="nav-item"><%= link_to "English", request.original_url + "?locale=en", class: "nav-link"%></li>
        <% end %>

      </ul>
    </div>
    <%= tag.image src: "/assets/lionprecision.jpeg", alt: "LionPrecision",style: "width:100px; height:70;", class: "navbar-brand"%>
  </div>
</nav>
